<?php
include("../../classes/bd.php");
include("../../classes/midia.php");

$_mid = new midia();

$dadosa	= $_mid->listaMidiaNoticiaAudio($_REQUEST["idnoticia"]);
$dados	= $_mid->listaMidiaNoticia($_REQUEST["idnoticia"]);
$dadosv	= $_mid->ListaMidiaYoutube($_REQUEST["idnoticia"]);

if(count($dados)==0 and count($dadosv)==0 and count($dadosa)==0 ){
echo "N&atilde;o h&aacute; midia cadastrada.";
}else{

foreach($dados as $midia){
$md	= $_mid->pega($midia['idmidia']);

?>

<div id="midia_<?=$midia['id']?>" style="width:110px; margin-right:5px; height:80px; float:left" align="center">


<?php if(strtolower($md["tipo"]) == "jpg"){?>
<img src="/imagem.php?imagem=imagens/midia/<?=$md['arquivo']?>&tam=100&tipo=3&corte=60"><br>
<? }else{ ?>
<img src="/imagens/icones/<?=strtoupper($md["tipo"])?>.png" width="80" alt="<?=$md["arquivo"]?>" />
<? }?>
<?=$md['arquivo']?>&nbsp; <img src="images/delete.gif" style="cursor:pointer" onClick="javascript:apagamidia(<?=$midia['id']?>);">

</div>
<? }
foreach($dadosv as $yout){?>
<div id="you_<?=$yout['id']?>" style="width:110px; margin-right:5px; height:80px; float:left" align="center">
<img src="/imagem.php?imagem=<?=$_mid->youtubeImage($yout['url'])?>&tam=100&tipo=3&corte=60" title="<?=$yout['titulo']?>" alt="<?=$yout['titulo']?>" />
<br />
Youtube Video <img src="images/delete.gif" style="cursor:pointer" onClick="javascript:apagamidiaYoutube(<?=$yout['id']?>);">
</div>
<? }

foreach($dadosa as $ad){
$md	= $_mid->pega($ad['idmidia']);

?>

<div id="midia_<?=$ad['id']?>" style="width:110px; margin-right:5px; height:80px; float:left" align="center">


<?php if(strtolower($md["tipo"]) == "jpg"){?>
<img src="/imagem.php?imagem=imagens/midia/<?=$md['arquivo']?>&tam=100&tipo=3&corte=60"><br>
<? }else{ ?>
<img src="/imagens/icones/<?=strtoupper($md["tipo"])?>.png" width="80" alt="<?=$md["arquivo"]?>" />
<? }?>
<?=$md['arquivo']?>&nbsp; <img src="images/delete.gif" style="cursor:pointer" onClick="javascript:apagamidia(<?=$ad['id']?>);">

</div>
<? }



}

?>
<div class="clear"></div>